import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yt_devops/configs.dart';
import 'package:yt_devops/routers/router_path.dart';
import 'package:yt_devops/services/common/common_services.dart';
import 'package:yt_devops/utils/toast_utils.dart';

class SuggestionController extends GetxController {
  CommonServices commonServices = CommonServices();
  // 输入控制器
  TextEditingController contentController = TextEditingController();
  //意见
  String discroption = '';

  bool get buttonEnabled => discroption.isNotEmpty;

  ///站点图片列表
  List<String> deviceImageList = [];
  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {}

  @override
  void onClose() {}

  textChange(String input) {
    discroption = input;
    update();
  }

  commit() => Configs.httpClient.requestWithLoading(() async {
        await commonServices.feedback(
            {'description': discroption, 'photos': deviceImageList.join(',')});
        Get.offAndToNamed(RouterPath.suggestCommitSuccess);
      });
}
